CashWheelClient.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. "use client";
  2. import Box from "@/components/Box";
  3. import { Link } from "@/i18n/routing";
  4. import { useUserInfoStore } from "@/stores/useUserInfoStore";
  5. import { copyText } from "@/utils/methods";
  6. import { LuckyWheel } from "@lucky-canvas/react";
  7. import { useCountDown } from "ahooks";
  8. import { Popup, Toast } from "antd-mobile";
  9. import clsx from "clsx";
  10. import { useTranslations } from "next-intl";
  11. import Image from "next/image";
  12. import { useRef, useState } from "react";
  13. import LotteryWheel from "./LotteryWheel";
  14. import styles from "./style.module.scss";
  15. const CashMainCom = () => {
  16. return (
  17. <div className={`${styles.cashMain} ${styles.cashMain} ${styles.type1}`}>
  18. <div className={styles.haveCash}>
  19. <img src="/wheel/cash.png" alt="" className={styles.cashImg} />
  20. <div>
  21. {" "}
  22. R$ <span className={styles.cash}>94.15</span>
  23. </div>
  24. <span className={styles.withdraw}>
  25. <img src="/wheel/pix.png" alt="" /> SACAR{" "}
  26. </span>
  27. </div>
  28. <div className={styles.progress}>
  29. <div className={styles.num}> 94.15%</div>
  30. <div className={styles.bar}>
  31. <span style={{ width: "calc(97.15% - 0.07rem)" }}></span>
  32. </div>
  33. </div>
  34. <div className={styles.needCash}>
  35. {" "}
  36. Ainda e necessário <span className={styles.needCashNum}>5.85</span> para realizar do
  37. saque{" "}
  38. </div>
  39. </div>
  40. );
  41. };
  42. const DrawMain1 = () => {
  43. return (
  44. <div className={styles.drawMain}>
  45. <div className={styles.draw}>
  46. {/*<img src="/wheel/d.png" className={styles.lamp} />*/}
  47. {/*<img src="/wheel/light1.png" className={styles.light1} />*/}
  48. {/*<img src="/wheel/light2.png" className={styles.light2} />*/}
  49. {/*<div className={styles.pointer}>*/}
  50. {/* <img src="/wheel/pointer.png" />*/}
  51. {/*</div>*/}
  52. {/*<img src="/wheel/bg_light.png" className={styles.drawBgImg} />*/}
  53. {/*<div className={`${styles.drawLen} ${styles.position} `}></div>*/}
  54. {/* <div className={styles.drawContents}>
  55. <canvas id={styles.draw} width={306} height={306} />
  56. </div> */}
  57. <LotteryWheel />
  58. </div>
  59. </div>
  60. );
  61. };
  62. const DrawContent = () => {
  63. return (
  64. <div className={styles.drawContent}>
  65. <div className={styles.text}>
  66. <span>
  67. <span style={{ color: "rgb(135, 149, 177)" }}>Expira em</span> 2d 19:18:13
  68. </span>
  69. </div>
  70. <div className={styles.cashButton}>
  71. <div> Convide amigos para ajudar com saques</div>
  72. <div className={`${styles.iconfont} ${styles.iconShare}`}></div>
  73. </div>
  74. </div>
  75. );
  76. };
  77. type Dtltype = "left" | "right";
  78. const LeftListClient = () => {
  79. const winListData = Array(500).fill("1");
  80. return (
  81. <>
  82. {winListData.length > 0 &&
  83. winListData.map((item, index) => {
  84. return (
  85. <div className={styles.item} key={index}>
  86. <span className={`${styles.name} ${styles.omitWrap}`}>
  87. 5533******412
  88. </span>
  89. <span className={styles.tipText}> Acabou de saca </span>
  90. <div className={styles.value}>
  91. <span className={styles.addCash}>+100</span>
  92. <span className={styles.unit}> R$</span>
  93. </div>
  94. </div>
  95. );
  96. })}
  97. </>
  98. );
  99. };
  100. const Report = () => {
  101. const [activeTab, setActiveTab] = useState<Dtltype>("left");
  102. const handler = (dtl: Dtltype) => {
  103. setActiveTab(dtl);
  104. };
  105. const activeClass = clsx(
  106. styles.vanTabItem,
  107. activeTab === "left" ? styles.vanTabAcriveLeft : styles.vanTabAcriveRight
  108. );
  109. return (
  110. <div className={styles.report}>
  111. <div className={`${styles.vanTabs} ${styles.vanTabsLine}`}>
  112. <div className={styles.vanTabsWrap}>
  113. <div className={styles.vanTabsNav}>
  114. <div
  115. className={`${styles.vanTabItem} ${activeTab === "right" ? styles.vanTabAcriveRight : ""} `}
  116. onClick={() => handler("left")}
  117. >
  118. <span className={activeTab === "left" ? styles.activeText : ""}>
  119. Relatório
  120. </span>
  121. </div>
  122. <div
  123. className={`${styles.vanTabItem} ${activeTab === "left" ? styles.vanTabAcriveLeft : ""}`}
  124. onClick={() => handler("right")}
  125. >
  126. <span className={activeTab === "right" ? styles.activeText : ""}>
  127. Minha Referencia
  128. </span>
  129. </div>
  130. </div>
  131. </div>
  132. <div className={styles.vanTabsContent}>
  133. <div className={styles.vantabpane}>
  134. <div className={styles.tabContent}>
  135. <div
  136. className={`${styles.winList} ${styles.swipernoswiping} ${styles.type2}`}
  137. >
  138. {activeTab === "left" ? <LeftListClient /> : null}
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div className={styles.rules}>
  145. <h2>Regras</h2>
  146. <ul className={styles.tipsContent}>
  147. <li>1.Você pode iniciar um saque quando o valor acumulado atingir 100 BRL. </li>
  148. <li>
  149. 2.Convidar amigos para se registrarem no 9f.com irá ajudá- lo a sacar
  150. dinheiro rapidamente.
  151. </li>
  152. <li>3. Cada usuário receberá uma única rodada grátis por dia. </li>
  153. <li>
  154. 4.Cada usuário tem um período de validade de 3 dias para cada atividade e
  155. pode participar da atividade várias vezes.
  156. </li>
  157. <li>
  158. 5.Se você receber um bônus de dinheiro extra, pode jogar jogos de graça e
  159. ganhar ainda mais dinheiro real.
  160. </li>
  161. <li>6.Se voce nao retirar o dinheiro dentro de 3 dias,ele ser perdido.</li>
  162. </ul>
  163. </div>
  164. </div>
  165. );
  166. };
  167. const WheelWallet = () => {
  168. const user = useUserInfoStore((state) => state.userInfo);
  169. return (
  170. <Box className={"absolute top-0 w-[100%]"}>
  171. <div
  172. style={{
  173. background: "url(/wheels/wheel-wallet.png)",
  174. backgroundSize: "100% 100%",
  175. }}
  176. className={"relative h-[1.4583rem] w-[100%] p-[0.1389rem]"}
  177. >
  178. <div className={"mb-[10px] text-[#49c25a]"}>
  179. <span className={"iconfont icon-yonghu"}></span>
  180. <span>Conta</span>
  181. <span>{user.user_phone}</span>
  182. </div>
  183. <div className={"text-[0.3472rem] font-bold text-[#008213]"}>
  184. R$
  185. <span>111</span>
  186. </div>
  187. <div className={"mt-[0.2083rem] w-[100%] text-center text-[18px]"}>
  188. <span className={"mr-[10px] text-[#008213]"}>Faltam para O saque</span>
  189. <span className={"text-[yellow]"}>R$9.36</span>
  190. </div>
  191. </div>
  192. </Box>
  193. );
  194. };
  195. const DrawMain = () => {
  196. const myLucky = useRef<any>();
  197. const desktopWheelRef = useRef<any>();
  198. const [blocks] = useState([
  199. {
  200. padding: "0",
  201. imgs: [
  202. {
  203. src: "/wheels/wheel.png",
  204. width: "100%",
  205. height: "100%",
  206. },
  207. ],
  208. },
  209. ]);
  210. const [prizes] = useState([
  211. { fonts: [{ text: "0", top: "20%" }] },
  212. { fonts: [{ text: "1", top: "20%" }] },
  213. { fonts: [{ text: "2", top: "20%" }] },
  214. { fonts: [{ text: "3", top: "20%" }] },
  215. { fonts: [{ text: "4", top: "20%" }] },
  216. { fonts: [{ text: "5", top: "20%" }] },
  217. { fonts: [{ text: "6", top: "20%" }] },
  218. { fonts: [{ text: "7", top: "20%" }] },
  219. ]);
  220. const [buttons] = useState([
  221. {
  222. radius: "30%",
  223. imgs: [
  224. {
  225. src: "/wheels/pointer.png",
  226. width: "100%",
  227. top: "-130%",
  228. },
  229. ],
  230. },
  231. ]);
  232. const [defaultConfig] = useState({
  233. offsetDegree: 20,
  234. });
  235. return (
  236. <div className={"relative"}>
  237. <WheelWallet />
  238. <div className={"relative hidden w-[100%] pt-[20px] sm:block"}>
  239. <img src={"/wheels/wheel-bg.png"} className={"w-[100%]"} />
  240. <img
  241. src={"/wheels/title.png"}
  242. className={"absolute left-[13%] top-[53%] z-10 w-[70%] object-cover"}
  243. />
  244. {/*定位到中心圆*/}
  245. <div className={"absolute bottom-[0.0347rem] h-[2.6736rem] w-[100%]"}>
  246. <div className={"flex h-[100%] w-[100%] justify-center text-center"}>
  247. {/* 图片切换动画 */}
  248. <img
  249. src="/wheels/light-1.png"
  250. alt=""
  251. className={"mr-[0.0556rem] h-[100%]"}
  252. />
  253. <div
  254. className={
  255. "mr-[0.07rem] flex h-[2.35rem] w-[2.35rem] " +
  256. " absolute" +
  257. " bottom-[0.17rem] z-50 rounded-[50%]"
  258. }
  259. >
  260. {/*<div*/}
  261. {/* className={*/}
  262. {/* "absolute h-[100%] w-[100%] rounded-[50%] " +*/}
  263. {/* " z-50 border-[red]" +*/}
  264. {/* ""*/}
  265. {/* }*/}
  266. {/* style={{*/}
  267. {/* boxShadow: "rgba(255, 255, 255, 1) 0px 0px 60px 12px inset",*/}
  268. {/* }}*/}
  269. {/*>*/}
  270. {/*</div>*/}
  271. <LuckyWheel
  272. ref={myLucky}
  273. width="2.35rem"
  274. height="2.35rem"
  275. blocks={blocks}
  276. defaultConfig={defaultConfig}
  277. prizes={prizes}
  278. buttons={buttons}
  279. onStart={() => {
  280. // 点击抽奖按钮会触发star回调
  281. myLucky.current?.play();
  282. setTimeout(() => {
  283. const index = (Math.random() * 6) >> 0;
  284. myLucky.current?.stop(index);
  285. }, 2500);
  286. }}
  287. onEnd={(prize: any) => {
  288. // 抽奖结束会触发end回调
  289. alert("恭喜你抽到 " + prize.fonts[0].text + " 号奖品");
  290. }}
  291. />
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. <div className={"relative block w-[100%] pt-[20px] sm:hidden"}>
  297. <img src={"/wheels/wheel-bg.png"} className={"w-[100%]"} />
  298. <img
  299. src={"/wheels/title.png"}
  300. className={"absolute left-[13%] top-[53%] z-10 w-[70%] object-cover"}
  301. />
  302. {/*定位到中心圆*/}
  303. <div className={"absolute bottom-[0.0347rem]" + " h-[2.5rem]" + " w-[100%]"}>
  304. <div className={"flex h-[100%] w-[100%] justify-center text-center"}>
  305. {/* 图片切换动画 */}
  306. <img
  307. src="/wheels/light-1.png"
  308. alt=""
  309. className={"mr-[0.0556rem] h-[100%]"}
  310. />
  311. <div
  312. className={
  313. "-mr-[0.05rem] flex h-[2.3rem] w-[2.3rem] " +
  314. " absolute" +
  315. " bottom-[0.045rem]"
  316. }
  317. >
  318. {/*<div*/}
  319. {/* className={*/}
  320. {/* "absolute h-[100%] w-[100%] rounded-[50%] " +*/}
  321. {/* " z-50 border-[red]" +*/}
  322. {/* ""*/}
  323. {/* }*/}
  324. {/* style={{*/}
  325. {/* boxShadow: "rgba(255, 255, 255, 1) 0px 0px 60px 12px inset",*/}
  326. {/* }}*/}
  327. {/*>*/}
  328. {/*</div>*/}
  329. <LuckyWheel
  330. ref={desktopWheelRef}
  331. width="2.2rem"
  332. height="2.2rem"
  333. blocks={blocks}
  334. defaultConfig={defaultConfig}
  335. prizes={prizes}
  336. buttons={buttons}
  337. onStart={() => {
  338. // 点击抽奖按钮会触发star回调
  339. desktopWheelRef.current?.play();
  340. setTimeout(() => {
  341. const index = (Math.random() * 6) >> 0;
  342. desktopWheelRef.current?.stop(index);
  343. }, 2500);
  344. }}
  345. onEnd={(prize: any) => {
  346. // 抽奖结束会触发end回调
  347. alert("恭喜你抽到 " + prize.fonts[0].text + " 号奖品");
  348. }}
  349. />
  350. </div>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. );
  356. };
  357. const CountdownClient = () => {
  358. const [_, formattedRes] = useCountDown({
  359. leftTime: 60 * 100000,
  360. });
  361. const { days, hours, minutes, seconds } = formattedRes;
  362. return (
  363. <div className={"relative flex justify-center"}>
  364. <img src="/wheels/countdown-bg.png" alt="" />
  365. <span className={"absolute bottom-[50%] translate-y-1/2"}>
  366. {String(hours).padStart(2, "0")}:{String(minutes).padStart(2, "0")}:
  367. {String(seconds).padStart(2, "0")}
  368. </span>
  369. </div>
  370. );
  371. };
  372. const ShareClient = () => {
  373. const [visible, setVisible] = useState(false);
  374. const shareUrl = process.env.NEXT_PUBLIC_SHARE_URL as string;
  375. const url = encodeURIComponent(`${shareUrl}`);
  376. const text = encodeURIComponent(`Receba 100 BRL de graça,Pix SAQUE RÁPIDO`);
  377. const t = useTranslations();
  378. const SHARE_SOURCE = [
  379. {
  380. icon: "/summary/Facebook.png",
  381. label: "Facebook",
  382. shareUrl: `https://www.facebook.com/sharer/sharer.php?u=${url}&t=${text}`,
  383. },
  384. {
  385. icon: "/summary/WhatsApp.png",
  386. label: "WhatsApp",
  387. shareUrl: `https://api.whatsapp.com/send?text=${text}`,
  388. },
  389. {
  390. icon: "/summary/Telegram.png",
  391. label: "Telegram",
  392. shareUrl: `https://t.me/share/url?url=${url}&text=${text}`,
  393. },
  394. {
  395. icon: "/summary/Twitter.png",
  396. label: "Twitter",
  397. shareUrl: `https://twitter.com/intent/tweet?text=${text}`,
  398. },
  399. {
  400. icon: "/summary/Email.png",
  401. label: "Email",
  402. shareUrl: `mailto: ?&subject=&cc=&bcc=&body=${url}%0A${text}`,
  403. },
  404. ];
  405. const copy = (text: string) => {
  406. copyText(text);
  407. Toast.show({ icon: "success", content: t("SummaryPage.copySuc"), maskClickable: false });
  408. };
  409. return (
  410. <>
  411. <div className={"p-[0.1389rem]"}>
  412. <div
  413. className={
  414. "rounded-[0.1111rem] bg-gradient-to-b from-[#84ea24_20%] to-[#1b781a]" +
  415. " h-[0.4861rem]"
  416. }
  417. >
  418. <div className={"flex h-[100%] p-[0.0694rem]"}>
  419. <div
  420. className={
  421. "flex-1 rounded-[0.0694rem] bg-[rgba(255,255,255,0.5)]" +
  422. " flex items-center pl-[0.0694rem]"
  423. }
  424. >
  425. <span className={""}>Compartilhe mais, saque mais rápido.</span>
  426. </div>
  427. <div
  428. className={"flex w-[0.4167rem] items-center pl-[0.0694rem]"}
  429. onClick={() => setVisible(true)}
  430. >
  431. <Image src={"/wheels/share.png"} alt={"share"} width={30} height={30} />
  432. </div>
  433. </div>
  434. </div>
  435. </div>
  436. <Popup
  437. visible={visible}
  438. getContainer={null}
  439. onMaskClick={() => {
  440. setVisible(false);
  441. }}
  442. onClose={() => {
  443. setVisible(false);
  444. }}
  445. showCloseButton
  446. bodyStyle={{ height: "2.9rem", background: "#fff" }}
  447. >
  448. <div className={"p-[0.1389rem] text-[#555555]"}>
  449. <h1>1.Convide amlgos para ajudar com saques</h1>
  450. <div
  451. className={"mt-[0.1389rem] grid grid-cols-5 justify-center gap-[0.1389rem]"}
  452. >
  453. {SHARE_SOURCE.map((source, index) => {
  454. return (
  455. <a
  456. href={source.shareUrl}
  457. key={index}
  458. target={"_blank"}
  459. className={"flex flex-col items-center"}
  460. >
  461. <Image src={source.icon} alt={"Mais"} width={70} height={70} />
  462. <p className={"mt-[0.0347rem] text-[12px] text-[#808080]"}>
  463. {source.label}
  464. </p>
  465. </a>
  466. );
  467. })}
  468. </div>
  469. <div className={"mt-[0.0694rem]"}>
  470. <h1 className={"text-[14px]"}>
  471. Compartilhe este link de indicação com seus amigos
  472. </h1>
  473. <div
  474. className={
  475. "rounded-[3px] bg-[#f9f9f9] p-[0.0694rem] text-[#808080]" +
  476. " mt-[0.0347rem] flex items-center"
  477. }
  478. >
  479. <span className={"flex-1"}>{shareUrl}</span>
  480. <span
  481. id="copy"
  482. className={"text-[#40a1de]"}
  483. onClick={() => copy(shareUrl)}
  484. >
  485. {t("SummaryPage.Cópia")}
  486. </span>
  487. </div>
  488. </div>
  489. <div className={"mt-[0.0694rem]"}>
  490. <h1>2.Enviar convite para jogador aleatório ajudar</h1>
  491. <div
  492. className={
  493. "grid grid-cols-2 gap-[0.1389rem] text-[0.12rem] text-[#fff]" +
  494. " mt-[0.0694rem]"
  495. }
  496. >
  497. <Link
  498. href={"#"}
  499. className={
  500. "flex items-center rounded-[0.0694rem] bg-[#10cb8c]" +
  501. " p-[0.0694rem] text-[#fff]"
  502. }
  503. >
  504. <div className={"flex-1"}>
  505. <p>Enviar Mensagem </p>
  506. <p>no WhatsAPP</p>
  507. </div>
  508. <Image
  509. src={"/summary/WhatsApp-nobg.png"}
  510. alt={"whatsApp"}
  511. width={40}
  512. height={40}
  513. />
  514. </Link>
  515. <Link
  516. href={"sms:10086?body=message_body"}
  517. className={
  518. "flex items-center rounded-[10px] bg-[#35b2fe]" +
  519. " p-[0.0694rem] text-[#fff]"
  520. }
  521. >
  522. <div className={"flex-1"}>
  523. <p>Enviar Mensagem </p>
  524. <p>SMS</p>
  525. </div>
  526. <Image
  527. src={"/summary/SMS.png"}
  528. alt={"whatsApp"}
  529. width={40}
  530. height={40}
  531. />
  532. </Link>
  533. </div>
  534. </div>
  535. </div>
  536. </Popup>
  537. </>
  538. );
  539. };
  540. const CashWheelClient = () => {
  541. return (
  542. <>
  543. <DrawMain />
  544. {/*倒计时*/}
  545. <CountdownClient />
  546. {/*分享*/}
  547. <ShareClient />
  548. <div className={styles.cashWheelClient}>
  549. {/*<CashMainCom />*/}
  550. {/*<DrawContent />*/}
  551. <Report />
  552. {/*<LotteryWheel />*/}
  553. </div>
  554. </>
  555. );
  556. };
  557. export default CashWheelClient;